﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using ServiceAgent.UserAccountService;
using System.ComponentModel;

namespace UserAccountModule.Models
{
    public class User : IDataErrorInfo
    {
        
        public int ID { get; set; }
        
        public int DienThoai { get; set; }
        
        public string Email { get; set; }
        
        public bool GioiTinh { get; set; }
        
        public Boolean IsLocked { get; set; }
        
        public string MatKhau { get; set; }
        
        public string TenNguoiDung { get; set; }
        
        public string TenTaiKhoan { get; set; }
        
        public ObservableCollection<QuyenDTO> DanhSachQuyen { get; set; }
        
        public ObservableCollection<DonViDTO> DanhSachDonVi { get; set; }

        #region IDataErrorInfo Members

        public string Error
        {
            get { return null; }
        }

        public string this[string propertyName]
        {
            get
            {
                string error = null;
                switch (propertyName)
                {
                    case "TenNguoiDung":
                        if (TenNguoiDung.Count()>20)
                            error = "Tên quá dài";
                        break;
                    default:
                        throw new Exception("Unexpected property: " + propertyName);
                }
                return error;
            }
        }

        #endregion
    }
}
